package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.YikatongBean;
import com.lwj.liwanjia.impl.YikatongView;
import com.lwj.liwanjia.model.YikatongModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/17.
 */

public class YikatongPresenter {
    private YikatongView yikatongView;
    private YikatongModel yikatongModel;

    public YikatongPresenter(YikatongView yikatongView) {
        this.yikatongView = yikatongView;
        yikatongModel = new YikatongModel();
    }

    public void getYikatongData(String token) {
        if (yikatongView != null) {
            yikatongModel.getYikatongData(token, new Subscriber<YikatongBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    yikatongView.showError((Exception) e);
                }

                @Override
                public void onNext(YikatongBean yikatongBean) {
                    yikatongView.getYikatongData(yikatongBean);
                }
            });
        }
    }
}
